/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package monitoring.logic;

import java.sql.SQLException;
import java.util.List;
import monitoring.beans.XLS.MonitoringXLS;
import monitoring.beans.database.MonitoringDB;
import monitoring.beans.util.FilterBean;
import monitoring.dbpersistence.MonitoringDBPersistence;
import monitoring.mapping.DBtoXLS;
import monitoring.ws.ExportMessage;
import monitoring.xlspersistence.MonitoringXLSPersistence;

/**
 *
 * @author Regulus
 */
public class Export {

    public ExportMessage export(List<FilterBean> bean) throws SQLException, Exception {//bean=filter
        MonitoringDBPersistence monitDbPersist = new MonitoringDBPersistence();
        List<MonitoringDB> listDb = monitDbPersist.getList(bean);
        
        DBtoXLS dbToXls = new DBtoXLS();
        List<MonitoringXLS> listXls = dbToXls.mapping(listDb);

        MonitoringXLSPersistence mXlsPersist = new MonitoringXLSPersistence();
        ExportMessage result = mXlsPersist.persist(listXls);
        return result;
    }
}
